﻿using KinectWindows.Controls;
using KinectWindows.Math;
using KinectWindows.Nui;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace KinectWindows.Windows
{
    public abstract class NuiWindow : NuiControl,ISpeekable,IGesturable
    {
        private List<NuiControl> ControlsCollection=new List<NuiControl>();
        private ControlStateFlag CurrentState;
        public void Add(NuiControl conrol)
        {
            ControlsCollection.Add(conrol);
        }
        public void Remove(NuiControl conrol)
        {
            ControlsCollection.Remove(conrol);
        }
        public NuiControl GetAt(int indx)
        {
            return ControlsCollection[indx];
        }
        public void SetAt(NuiControl control,int indx)
        {
            ControlsCollection[indx] = control;
        }


        public void Show()
        {
        }
        public void ShowDialogBox()
        {
        }
        public void Hide()
        {
        }


        /// <summary>
        /// Called by the Kinect Engine To Test the hands response
        /// </summary>
        /// <param name="point">Screen Location</param>
        /// <param name="hand">Hand</param>
        public virtual void TestHit(Vector2 point,HandFlag hand)
        {
            //foreach (NuiControl c in ControlsCollection)
            //{
            //    if (hand == HandFlag.LEFT_HAND) c.LeftHandHitTest(point);
            //    else c.RightHandHitTest(point);
                
            //}
        }

        public virtual void OnSpeechDetected(string cmd)
        {
           
        }

        public virtual void OnSwipeRightHand()
        {
            
        }

        public virtual void OnSwipeLefthand()
        {
            
        }

        public virtual void OnWave()
        {
            
        }
        public virtual void OnGenericMessage(Object[] args)
        {
        }
        public virtual void MessageLoop(NuiEvent nevent){}

        public abstract void PostMessage(NuiEvent nevent);
    }
    [Flags]
    public enum HandFlag
    {
        LEFT_HAND,
        RIGHT_HAND
    }
    [Flags]
    public enum WindowStateFlag
    {
        SHOWN,
        HIDDEN
    }
    

    
}
